# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=libslirp
pkgver=4.3.1
pkgrel=0
pkgdesc="A general purpose TCP-IP emulator"
url="https://gitlab.freedesktop.org/slirp/libslirp"
arch="all"
license="BSD-3-Clause"
makedepends="meson glib-dev"
subpackages="$pkgname-dev"
options="!check" # no test suite
source="https://gitlab.freedesktop.org/slirp/libslirp/-/archive/v$pkgver/libslirp-v$pkgver.tar.gz
	version.patch"
builddir="$srcdir/$pkgname-v$pkgver"

# secfixes:
#   4.3.1-r0:
#     - CVE-2020-10756
#   4.3.0-r0:
#     - CVE-2020-1983

prepare() {
	default_prepare
	sed -i "s/%SLIRP_VERSION%/$pkgver/g" meson.build
}

build() {
	meson \
		--buildtype=plain \
		--prefix=/usr \
		--libdir=/usr/lib \
		build
	ninja -C build
}

package() {
	DESTDIR="$pkgdir" ninja -C build install
}

sha512sums="fa38a5e508b00802538f8466b8b52fc4842d6f7f74caa399db1011c15bb37198678415147327a606e3f259fd5def9390012df1d4dc76e8869e9bb77ca6514005  libslirp-v4.3.1.tar.gz
adb828ebbaeecbba313c028b34deb96ad592f53fb2f777d58286bf8397285be8714ae4cdbaad086168cc0ac7c729a2fc34e6e57f82c7d657c29884e3f3fa59aa  version.patch"
